package cn.edu.demo.controller;

import cn.edu.demo.pojo.Orders;
import cn.edu.demo.pojo.Passenger;
import cn.edu.demo.pojo.ResponseResult;
import cn.edu.demo.service.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
//@Controller
public class CancelController {

    @Autowired
    OrdersService service;

    @RequestMapping("/user/cancel")
    @ResponseBody
    public ResponseResult com(String o_id, String time){
        Orders cancel = service.cancel(o_id, time);

        if(cancel!=null){
            return new ResponseResult(120,"取消成功", null);
        }else{
            return new ResponseResult(121,"取消失败",null);
        }
//        return null;
    }

}
